<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/8/24
 * Time: 11:18
 */

namespace app\alliance\controller;


use think\Db;

class DownLoad
{
    function downloadProject()
    {
        $ip = getsIp();
        $num = Db::connect("db_config2")->field("num")->table("download")->where(array("id" => 1))->find()['num'];
        Db::connect("db_config2")->table("download_info")->insert(array("ip" => $ip, 'time' => date('Y-m-d H:i:s')));
        if (is_null($num)) {
            Db::connect("db_config2")->table("download")->insert(array("num" => 1));
        } else {
            $num++;
            $num = Db::connect("db_config2")->table("download")->where(array("id" => 1))->update(array("num" => $num));
        }

        $login = new Login();
        $info = $login->getsVersionControl();
        header("Location:" . $info['url']);
    }
}